<?php

namespace App\Helpers;

use Illuminate\Http\Response;

/**
 * Response represents an HTTP response.
 *
 * @author Paul Ventura <paul@yolotechnology.com>
 */
class SuccessResponse {

    public static function handler($data, $statusCode = Response::HTTP_OK)
    {
        return static::transformer($data, $statusCode);
    }

    public static function transformer($data, $statusCode)
    {
        return response()->json([
            'message' => Response::$statusTexts[$statusCode],
            'data' => $data,
            'status_code' => $statusCode
        ], $statusCode);
    }
    
    public static function transformerjson($data, $status , $statusCode = Response::HTTP_OK)
    {
        return response()->json([
            'message'     => Response::$statusTexts[$statusCode],
            'status'      => $status,
            'data'        => $data,
            'status_code' => $statusCode
        ], $statusCode);
    }
}